

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ConstrainedBox5_2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Row_Column_4_2"),
        ),
        body: Column(
          children: [
            Co1(),
          ],
        ));
  }
}


class Co1 extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    Widget redBox=DecoratedBox(
      decoration: BoxDecoration(color: Colors.red),
    );
    return ConstrainedBox(
      constraints: BoxConstraints(
          minWidth: double.infinity, //宽度尽可能大
          minHeight: 50.0 //最小高度为50像素
      ),
      child: Container(
          height: 5.0,
          child: redBox
      ),
    );
  }

}